package personal.wang.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Objects;

/**
 * @className: DefaultUtil
 * @Description:
 * @Author: wangyifei
 * @Date: 2022/6/10 11:01
 */
public class ConditionUtil {
    private static Logger logger = LoggerFactory.getLogger(ConditionUtil.class);
    public static <T> T anyDefault(T input , T defaultValue){
        T t = (T)(Objects.isNull(input)?defaultValue:input);
        return t ;
    }
    /**
     * @return:
     * @desc: 入参中有一个为null，则返回 true
     * @author
     * @date
     * @param
     */
    public static boolean checkNullArgs(Object... objs){
        if(Objects.isNull(objs)){
            logger.error("要执行的参数为 NULL , 入参不符合条件");
            return true;
        }
        for (Object obj : objs) {
            if(Objects.isNull(obj)){
                return true ;
            }
        }
        return false ;
    }
}
